﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PlatformUW.Entities
{
    public class SensorTable
    {
        /// <summary>
        /// 统一标识符
        /// </summary>
        public Guid Id { get; set; }

        /// <summary>
        /// 通道名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 通道描述
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        /// 站地址
        /// </summary>
        public int Station { get; set; }

        /// <summary>
        /// 只读存储器起始地址
        /// </summary>
        public int RO_Address { get; set; }

        /// <summary>
        /// 只读存储器长度
        /// </summary>
        public int RO_Length { get; set; }

        /// <summary>
        /// 读写存储器起始地址
        /// </summary>
        public int RW_Address { get; set; }

        /// <summary>
        /// 读写存储器长度
        /// </summary>
        public int RW_Length { get; set; }

        /// <summary>
        /// 初始化是否使能
        /// </summary>
        public bool Enabled { get; set; }

        /// <summary>
        /// 端口类型
        /// </summary>
        public PortCategory PortCategory { get; set; }

        /// <summary>
        /// 通道远程IP地址
        /// </summary>
        public string Ip { get; set; }

        /// <summary>
        /// 远程通道端口地址
        /// </summary>
        public int Port { get; set; }

        /// <summary>
        /// UDP通信方式， 需要知道本地IP地址
        /// </summary>
        public string? localIp { get; set; }

        /// <summary>
        /// UDP通信方式，需要知道本地通信端口号
        /// </summary>
        public int localPort { get; set; }

        /// <summary>
        /// 串口通信方式，需要知道本地的通讯串口号
        /// </summary>
        public string? COMn { get; set; }

        /// <summary>
        /// 通信波特率
        /// </summary>
        public int Baudrate { get; set; }

        /// <summary>
        /// 串口参数  N-8-1
        /// </summary>
        public string? SerialParams { get; set; }

        /// <summary>
        /// 通信协议
        /// </summary>
        public ProtocolEnum Protocol { get; set; }

        /// <summary>
        /// 在MODBU协议下，是否支持21功能
        /// </summary>
        public bool optSupport21Cmd { get; set; }

        /// <summary>
        /// 在MODBU协议下，是否支持3/4功能分离
        /// </summary>
        public bool optSplit3_4Cmd { get; set; }

        /// <summary>
        /// 通信周期 ms
        /// </summary>
        public int Interval { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime DateCreated { get; set; }
    }
}
